package com.flower.oauthserver.controller;

import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.net.Authenticator;
import java.security.Principal;

/**
 * @ClassName AppController
 * @Description TODO
 * @Author 张晓焕
 * @Date 2022/7/11 17:14
 * @Version 1.0
 */
@RestController
public class AppController {
    @GetMapping("/info")
    public Principal login(Principal principal) {

        return principal;
    }

    @GetMapping("/getUserInfo")
    public Authentication getAuthentication(){
        return SecurityContextHolder.getContext().getAuthentication();
    }
}
